#include <vector>

using namespace std;
struct ListNode
{
    int val;
    ListNode *next;
};

class Solution
{
public:
    void Print(ListNode* head, vector<int>& ret)
    {
        if (head == nullptr)
        {
            return;
        }
        Print(head->next, ret);
        ret.push_back(head->val);
    }
    vector<int> reversePrint(ListNode *head)
    {
        vector<int> ret;
        Print(head, ret);
        return ret;
    }
};